﻿//GB/Z 29014.3 ISYC 314-01-ISO-A型刀夹

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using netDxf;
using netDxf.Blocks;
using netDxf.Collections;
using netDxf.Entities;
using netDxf.Header;
using netDxf.Objects;
using netDxf.Tables;
using netDxf.Units;
using Attribute = netDxf.Entities.Attribute;
using Image = netDxf.Entities.Image;
using Point = netDxf.Entities.Point;
using Trace = netDxf.Entities.Trace;
using System.Threading;

namespace TestDxfDocument
{
    class class_ISYC_314_01
    {
        public static void ISYC_314_F141(Dictionary<string, Object> data)
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中性线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层

            //基本参数-------------------------------------------------------------------------------------------------
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);

            //赋值参数--------------------------------------------------------------------------------------------------
            double scale = 1;
            double LPR = 30.25;
            double LTA = 27.7;
            double H = 7.79;
            double HF = 7.79;
            double OAL = 39.29;
            double WF = 10.78;
            double KAPR = 58;
            double WTA = 4.12;
            double LS = 24.73;
            double ASP = 4.37;
            double LH = 11.02;
            double B = 7.78;
            double LFA = WTA / Math.Tan(KAPR * pi / 180);

            //点---------------------------------------------------------------------------------------------
            //第一部分
            //轮廓
            Vector2 v1 = new Vector2(0, 0);
            Vector2 v2 = new Vector2(v1.X - OAL + ASP, v1.Y);
            Vector2 v3 = new Vector2(v2.X, v2.Y - H);
            Vector2 v4 = new Vector2(v3.X + (30.83 / 39.29) * OAL, v3.Y);
            Vector2 v5 = new Vector2(v4.X + (2.58 / 39.29) * OAL, v4.Y + (5.54 / 7.79) * H);
            Vector2 v6 = new Vector2(v5.X + (1.47 / 39.29) * OAL, v5.Y);
            Vector2 v7 = new Vector2(v6.X - (LFA + WTA), v5.Y);
            Vector2 v8 = new Vector2(v7.X, v1.Y);
            Vector2 v9 = new Vector2(v1.X - LFA, v1.Y);
            Vector2 v10 = new Vector2(v1.X - LFA, v6.Y);
            Vector2 v11 = new Vector2(v8.X + fun.CalDistance(v8, v1) / 2.0, v1.Y);
            Vector2 v12 = new Vector2(v1.X - (OAL - LS), v1.Y);
            Vector2 v13 = fun.Inters(v12, fun.Polar(v12, -65 * pi / 180, OAL), v3, v4);
            Vector2 v14 = new Vector2(v2.X, v2.Y - (3.17 / 7.79) * H);
            Vector2 v15 = new Vector2(v14.X - (2.05 / 39.29) * OAL, v14.Y);
            Vector2 v16 = new Vector2(v15.X, v15.Y + (1.46 / 7.79) * H);
            Vector2 v17 = new Vector2(v16.X - (1.49 / 39.29) * OAL, v16.Y);
            Vector2 v18 = new Vector2(v17.X, v17.Y - (4.39 / 7.79) * H);
            Vector2 v19 = new Vector2(v16.X, v18.Y);
            Vector2 v20 = new Vector2(v19.X, v19.Y + (1.46 / 7.79) * H);
            Vector2 v21 = new Vector2(v14.X, v20.Y);
            Vector2 v22 = new Vector2(v2.X + (2.16 / 39.29) * OAL, v2.Y - fun.CalDistance(v2, v3) / 2.0);
            Vector2 v23 = new Vector2(v2.X + (5.03 / 39.29) * OAL, v22.Y);
            Vector2 v24 = new Vector2(v22.X + (0.77 / 39.29) * OAL, v22.Y + (0.88 / 7.79) * H);
            Vector2 v25 = new Vector2(v24.X, v22.Y - (0.88 / 7.79) * H);
            Vector2 v26 = new Vector2(v24.X + (3.39 / 39.29) * OAL, v24.Y);
            Vector2 v27 = new Vector2(v26.X, v25.Y);
            Vector2 v28 = new Vector2(v24.X, v22.Y + (0.51 / 7.79) * H);
            Vector2 v29 = new Vector2(v24.X, v22.Y - (0.51 / 7.79) * H);
            Vector2 v30 = new Vector2(v26.X, v28.Y);
            Vector2 v31 = new Vector2(v26.X, v29.Y);
            Vector2 v32 = new Vector2(v23.X + (4.25 / 39.29) * OAL, v23.Y);
            Vector2 v33 = new Vector2(v32.X + (5.03 / 39.29) * OAL, v32.Y);
            Vector2 v34 = new Vector2(v32.X + (0.77 / 39.29) * OAL, v32.Y + (0.88 / 7.79) * H);
            Vector2 v35 = new Vector2(v32.X + (0.77 / 39.29) * OAL, v32.Y - (0.88 / 7.79) * H);
            Vector2 v36 = new Vector2(v34.X + (3.39 / 39.29) * OAL, v34.Y);
            Vector2 v37 = new Vector2(v36.X, v35.Y);
            Vector2 v38 = new Vector2(v34.X, v32.Y + (0.51 / 7.79) * H);
            Vector2 v39 = new Vector2(v34.X, v32.Y - (0.51 / 7.79) * H);
            Vector2 v40 = new Vector2(v36.X, v38.Y);
            Vector2 v41 = new Vector2(v40.X, v39.Y);
            Vector2 v42 = new Vector2(v9.X - LTA, v2.Y);
            Vector2 v43 = new Vector2(v17.X + fun.CalDistance(v17, v16) / 2.0, v22.Y);
            Vector2 v44 = new Vector2(v1.X - OAL, v3.Y);
            Vector2 v45 = new Vector2(v1.X + (9.59 / 39.29) * OAL, v1.Y);
            Vector2 v46 = new Vector2(v1.X + (8.94 / 39.29) * OAL, v1.Y);

            //第二部分
            //轮廓
            Vector2 v47 = new Vector2(v1.X, v1.Y - (27.13 / 7.79) * H);
            Vector2 v48 = new Vector2(v47.X - LFA, v47.Y - WTA);
            Vector2 v49 = new Vector2(v48.X - WTA, v48.Y + LFA);
            Vector2 v50 = new Vector2(v49.X + LFA, v49.Y + WTA);
            Vector2 v51 = fun.Inters(new Vector2(v47.X - (1.46 / 11.02) * LH, v47.Y - WF), new Vector2(v47.X - (1.46 / 11.02) * LH, v47.Y + WF), v50, v47);
            Vector2 v52 = new Vector2(v51.X, v51.Y + (3.85 / 10.78) * WF);
            Vector2 v53 = new Vector2(v52.X - (4.1 / 11.02) * LH, v48.Y + WF);
            Vector2 v54 = new Vector2(v3.X, v53.Y);
            Vector2 v55 = new Vector2(v54.X, v54.Y - B);
            Vector2 v57 = new Vector2(v13.X, v49.Y - (0.57 / 4.12) * WTA);
            Vector2 v56 = fun.Inters(v55, fun.Polar(v55, 0, OAL), v57, fun.Polar(v57, 122 * pi / 180, OAL));
            Vector2 v58 = fun.Inters(v57, fun.Polar(v57, 0, OAL), v49, v48);
            Vector2 v59 = new Vector2(v47.X - (OAL - LS), v53.Y);
            Vector2 v60 = fun.Inters(v59, fun.Polar(v59, -90 * pi / 180, OAL), v57, fun.Polar(v57, 122 * pi / 180, OAL));
            Vector2 v61 = fun.Inters(v60, fun.Polar(v60, pi, OAL), v54, v55);
            Vector2 v62 = new Vector2(v61.X, v61.Y - (1.59 / 7.78) * B);
            Vector2 v63 = new Vector2(v16.X, v62.Y);
            Vector2 v64 = new Vector2(v63.X, v63.Y + fun.CalDistance(v15, v16));
            Vector2 v65 = new Vector2(v64.X - fun.CalDistance(v16, v17), v64.Y);
            Vector2 v66 = new Vector2(v65.X, v65.Y - fun.CalDistance(v17, v18));
            Vector2 v67 = new Vector2(v64.X, v66.Y);
            Vector2 v68 = new Vector2(v67.X, v67.Y + fun.CalDistance(v15, v16));
            Vector2 v69 = new Vector2(v68.X + fun.CalDistance(v62, v63), v68.Y);
            Vector2 v70 = new Vector2(v64.X - fun.CalDistance(v64, v65) / 2.0, v63.Y - fun.CalDistance(v63, v68) / 2.0);
            Vector2 v71 = new Vector2(v22.X, v70.Y);
            Vector2 v72 = new Vector2(v23.X, v70.Y);
            Vector2 v73 = new Vector2(v24.X, v70.Y + fun.CalDistance(v24, v25) / 2.0);
            Vector2 v74 = new Vector2(v24.X, v70.Y - fun.CalDistance(v24, v25) / 2.0);
            Vector2 v75 = new Vector2(v26.X, v70.Y + fun.CalDistance(v24, v25) / 2.0);
            Vector2 v76 = new Vector2(v26.X, v70.Y - fun.CalDistance(v24, v25) / 2.0);
            Vector2 v77 = new Vector2(v28.X, v70.Y + fun.CalDistance(v28, v29) / 2.0);
            Vector2 v78 = new Vector2(v28.X, v70.Y - fun.CalDistance(v28, v29) / 2.0);
            Vector2 v79 = new Vector2(v30.X, v70.Y - fun.CalDistance(v28, v29) / 2.0);
            Vector2 v80 = new Vector2(v30.X, v70.Y + fun.CalDistance(v28, v29) / 2.0);
            Vector2 v81 = new Vector2(v32.X, v70.Y);
            Vector2 v82 = new Vector2(v33.X, v70.Y);
            Vector2 v83 = new Vector2(v34.X, v70.Y + fun.CalDistance(v24, v25) / 2.0);
            Vector2 v84 = new Vector2(v34.X, v70.Y - fun.CalDistance(v24, v25) / 2.0);
            Vector2 v85 = new Vector2(v36.X, v70.Y + fun.CalDistance(v24, v25) / 2.0);
            Vector2 v86 = new Vector2(v36.X, v70.Y - fun.CalDistance(v24, v25) / 2.0);
            Vector2 v87 = new Vector2(v34.X, v70.Y + fun.CalDistance(v28, v29) / 2.0);
            Vector2 v88 = new Vector2(v34.X, v70.Y - fun.CalDistance(v28, v29) / 2.0);
            Vector2 v89 = new Vector2(v36.X, v70.Y + fun.CalDistance(v28, v29) / 2.0);
            Vector2 v90 = new Vector2(v36.X, v70.Y - fun.CalDistance(v28, v29) / 2.0);
            Vector2 v91 = fun.Polar(v50, -(2 * pi - fun.CalAngle(v50, v48)), (1.35 / 10.78) * WF);
            Vector2 v92 = fun.Polar(v49, fun.CalAngle(v49, v47), (1.35 / 10.78) * WF);
            Vector2 v93 = fun.Polar(v48, fun.CalAngle(v48, v50), (1.35 / 10.78) * WF);
            Vector2 v94 = fun.Polar(v47, -(2 * pi - fun.CalAngle(v47, v49)), (1.35 / 10.78) * WF);
            Vector2 v95 = fun.Inters(v91, v93, v92, v94);
            Vector2 v96 = new Vector2(v48.X + (22.22 / 39.29) * OAL, v48.Y - (9.47 / 10.78) * WF);
            Vector2 v97 = new Vector2(v44.X, v54.Y);
            Vector2 v98 = new Vector2(v42.X, v54.Y);

            //作图部分-----------------------------------------------------------------------
            //第一部分
            //中心线
            Line line1 = new Line(v22, v23);
            line1.Layer = centre;
            line1.Linetype = Linetype.Center;
            line1.LinetypeScale = 5;
            dxf.AddEntity(line1);

            Line line2 = new Line(v24, v25);
            line2.Layer = centre;
            line2.Linetype = Linetype.Center;
            line2.LinetypeScale = 5;
            dxf.AddEntity(line2);

            Line line3 = new Line(v26, v27);
            line3.Layer = centre;
            line3.Linetype = Linetype.Center;
            line3.LinetypeScale = 5;
            dxf.AddEntity(line3);

            Line line4 = new Line(v32, v33);
            line4.Layer = centre;
            line4.Linetype = Linetype.Center;
            line4.LinetypeScale = 5;
            dxf.AddEntity(line4);

            Line line5 = new Line(v34, v35);
            line5.Layer = centre;
            line5.Linetype = Linetype.Center;
            line5.LinetypeScale = 5;
            dxf.AddEntity(line5);

            Line line6 = new Line(v36, v37);
            line6.Layer = centre;
            line6.Linetype = Linetype.Center;
            line6.LinetypeScale = 5;
            dxf.AddEntity(line6);

            //轮廓
            LwPolyline polyline1 = new LwPolyline();
            polyline1.Vertexes.Add(new LwPolylineVertex(v1));
            polyline1.Vertexes.Add(new LwPolylineVertex(v2));
            polyline1.Vertexes.Add(new LwPolylineVertex(v3));
            polyline1.Vertexes.Add(new LwPolylineVertex(v4));
            polyline1.Vertexes.Add(new LwPolylineVertex(v5));
            fun.PolyFill(dxf, polyline1, 0.3, contour);

            LwPolyline polyline2 = new LwPolyline();
            polyline2.Vertexes.Add(new LwPolylineVertex(v1));
            polyline2.Vertexes.Add(new LwPolylineVertex(v6));
            polyline2.Vertexes.Add(new LwPolylineVertex(v7));
            polyline2.Vertexes.Add(new LwPolylineVertex(v8));
            fun.PolyFill(dxf, polyline2, 0.3, contour);

            LwPolyline polyline3 = new LwPolyline();
            polyline3.Vertexes.Add(new LwPolylineVertex(v12));
            polyline3.Vertexes.Add(new LwPolylineVertex(v13));
            fun.PolyFill(dxf, polyline3, 0.3, contour);

            LwPolyline polyline4 = new LwPolyline();
            polyline4.Vertexes.Add(new LwPolylineVertex(v14));
            polyline4.Vertexes.Add(new LwPolylineVertex(v15));
            polyline4.Vertexes.Add(new LwPolylineVertex(v16));
            polyline4.Vertexes.Add(new LwPolylineVertex(v17));
            polyline4.Vertexes.Add(new LwPolylineVertex(v18));
            polyline4.Vertexes.Add(new LwPolylineVertex(v19));
            polyline4.Vertexes.Add(new LwPolylineVertex(v20));
            polyline4.Vertexes.Add(new LwPolylineVertex(v21));
            fun.PolyFill(dxf, polyline4, 0.3, contour);

            LwPolyline polyline5 = new LwPolyline();
            polyline5.Vertexes.Add(new LwPolylineVertex(v15));
            polyline5.Vertexes.Add(new LwPolylineVertex(v20));
            fun.PolyFill(dxf, polyline5, 0.3, contour);

            LwPolyline polyline6 = new LwPolyline();
            polyline6.Vertexes.Add(new LwPolylineVertex(v28));
            polyline6.Vertexes.Add(new LwPolylineVertex(v29));//0
            polyline6.Vertexes.Add(new LwPolylineVertex(v31));
            polyline6.Vertexes.Add(new LwPolylineVertex(v30));//2
            polyline6.Vertexes.Add(new LwPolylineVertex(v28));
            polyline6.Vertexes[0].Bulge = Math.Tan(180 * pi / 180 / 4);
            polyline6.Vertexes[2].Bulge = Math.Tan(180 * pi / 180 / 4);
            fun.PolyFill(dxf, polyline6, 0.3, contour);

            LwPolyline polyline7 = new LwPolyline();
            polyline7.Vertexes.Add(new LwPolylineVertex(v38));
            polyline7.Vertexes.Add(new LwPolylineVertex(v39));//0
            polyline7.Vertexes.Add(new LwPolylineVertex(v41));
            polyline7.Vertexes.Add(new LwPolylineVertex(v40));//2
            polyline7.Vertexes.Add(new LwPolylineVertex(v38));
            polyline7.Vertexes[0].Bulge = Math.Tan(180 * pi / 180 / 4);
            polyline7.Vertexes[2].Bulge = Math.Tan(180 * pi / 180 / 4);
            fun.PolyFill(dxf, polyline7, 0.3, contour);

            LwPolyline polyline8 = new LwPolyline();
            polyline8.Vertexes.Add(new LwPolylineVertex(v9));
            polyline8.Vertexes.Add(new LwPolylineVertex(v10));
            fun.PolyFill(dxf, polyline8, 0.3, contour);

            var arc1 = fun.DrawArc3(v17, new Vector2(v44.X, v17.Y - fun.CalDistance(v17, v18) / 2.0), v18);
            fun.drawBArc(dxf, arc1, 0.3, contour);

            fun.drawcircle(dxf, v43, (0.315 / 1.49) * fun.CalDistance(v16, v17), 0.3, contour);

            //第二部分
            //中心线
            Line line8 = new Line(v71, v72);
            line8.Layer = centre;
            line8.Linetype = Linetype.Center;
            line8.LinetypeScale = 5;
            dxf.AddEntity(line8);

            Line line9 = new Line(v73, v74);
            line9.Layer = centre;
            line9.Linetype = Linetype.Center;
            line9.LinetypeScale = 5;
            dxf.AddEntity(line9);

            Line line10 = new Line(v75, v76);
            line10.Layer = centre;
            line10.Linetype = Linetype.Center;
            line10.LinetypeScale = 5;
            dxf.AddEntity(line10);

            Line line11 = new Line(v81, v82);
            line11.Layer = centre;
            line11.Linetype = Linetype.Center;
            line11.LinetypeScale = 5;
            dxf.AddEntity(line11);

            Line line12 = new Line(v83, v84);
            line12.Layer = centre;
            line12.Linetype = Linetype.Center;
            line12.LinetypeScale = 5;
            dxf.AddEntity(line12);

            Line line13 = new Line(v85, v86);
            line13.Layer = centre;
            line13.Linetype = Linetype.Center;
            line13.LinetypeScale = 5;
            dxf.AddEntity(line13);

            //轮廓
            LwPolyline polyline9 = new LwPolyline();
            polyline9.Vertexes.Add(new LwPolylineVertex(v47));
            polyline9.Vertexes.Add(new LwPolylineVertex(v48));
            polyline9.Vertexes.Add(new LwPolylineVertex(v49));
            polyline9.Vertexes.Add(new LwPolylineVertex(v50));
            polyline9.Vertexes.Add(new LwPolylineVertex(v47));
            fun.PolyFill(dxf, polyline9, 0.3, contour);

            LwPolyline polyline10 = new LwPolyline();
            polyline10.Vertexes.Add(new LwPolylineVertex(v91));
            polyline10.Vertexes.Add(new LwPolylineVertex(v92));
            polyline10.Vertexes.Add(new LwPolylineVertex(v93));
            polyline10.Vertexes.Add(new LwPolylineVertex(v94));
            polyline10.Vertexes.Add(new LwPolylineVertex(v91));
            fun.PolyFill(dxf, polyline10, 0.3, contour);

            LwPolyline polyline11 = new LwPolyline();
            polyline11.Vertexes.Add(new LwPolylineVertex(v51));
            polyline11.Vertexes.Add(new LwPolylineVertex(v52));
            polyline11.Vertexes.Add(new LwPolylineVertex(v53));
            polyline11.Vertexes.Add(new LwPolylineVertex(v54));
            polyline11.Vertexes.Add(new LwPolylineVertex(v55));
            polyline11.Vertexes.Add(new LwPolylineVertex(v56));
            fun.PolyFill(dxf, polyline11, 0.3, contour);

            LwPolyline polyline12 = new LwPolyline();
            polyline12.Vertexes.Add(new LwPolylineVertex(v58));
            polyline12.Vertexes.Add(new LwPolylineVertex(v57));
            polyline12.Vertexes.Add(new LwPolylineVertex(v60));
            fun.PolyFill(dxf, polyline12, 0.3, contour);

            LwPolyline polyline13 = new LwPolyline();
            polyline13.Vertexes.Add(new LwPolylineVertex(v59));
            polyline13.Vertexes.Add(new LwPolylineVertex(v60));
            polyline13.Vertexes.Add(new LwPolylineVertex(v61));
            fun.PolyFill(dxf, polyline13, 0.3, contour);

            LwPolyline polyline14 = new LwPolyline();
            polyline14.Vertexes.Add(new LwPolylineVertex(v62));
            polyline14.Vertexes.Add(new LwPolylineVertex(v63));
            polyline14.Vertexes.Add(new LwPolylineVertex(v64));
            polyline14.Vertexes.Add(new LwPolylineVertex(v65));
            polyline14.Vertexes.Add(new LwPolylineVertex(v66));
            polyline14.Vertexes.Add(new LwPolylineVertex(v67));
            polyline14.Vertexes.Add(new LwPolylineVertex(v68));
            polyline14.Vertexes.Add(new LwPolylineVertex(v69));
            fun.PolyFill(dxf, polyline14, 0.3, contour);

            LwPolyline polyline15 = new LwPolyline();
            polyline15.Vertexes.Add(new LwPolylineVertex(v63));
            polyline15.Vertexes.Add(new LwPolylineVertex(v68));
            fun.PolyFill(dxf, polyline15, 0.3, contour);

            LwPolyline polyline16 = new LwPolyline();
            polyline16.Vertexes.Add(new LwPolylineVertex(v77));
            polyline16.Vertexes.Add(new LwPolylineVertex(v78));//0
            polyline16.Vertexes.Add(new LwPolylineVertex(v79));
            polyline16.Vertexes.Add(new LwPolylineVertex(v80));//2
            polyline16.Vertexes.Add(new LwPolylineVertex(v77));
            polyline16.Vertexes[0].Bulge = Math.Tan(180 * pi / 180 / 4);
            polyline16.Vertexes[2].Bulge = Math.Tan(180 * pi / 180 / 4);
            fun.PolyFill(dxf, polyline16, 0.3, contour);

            LwPolyline polyline17 = new LwPolyline();
            polyline17.Vertexes.Add(new LwPolylineVertex(v87));
            polyline17.Vertexes.Add(new LwPolylineVertex(v88));//0
            polyline17.Vertexes.Add(new LwPolylineVertex(v90));
            polyline17.Vertexes.Add(new LwPolylineVertex(v89));//2
            polyline17.Vertexes.Add(new LwPolylineVertex(v87));
            polyline17.Vertexes[0].Bulge = Math.Tan(180 * pi / 180 / 4);
            polyline17.Vertexes[2].Bulge = Math.Tan(180 * pi / 180 / 4);
            fun.PolyFill(dxf, polyline17, 0.3, contour);

            var arc2 = fun.DrawArc3(v65, new Vector2(v44.X, v65.Y - fun.CalDistance(v17, v18) / 2.0), v66);
            fun.drawBArc(dxf, arc2, 0.3, contour);

            fun.drawcircle(dxf, v70, (0.315 / 1.49) * fun.CalDistance(v16, v17), 0.3, contour);

            //标注---------------------------------------------------------------------------
            double height = 1 * scale;
            double arrowsize = 1 * scale;
            double exline = 0.5 * scale;

            //第一部分
            //坐标系
            /*fun.Axis(dxf, v44, 90, 180, "Y", "Z", "PCS", 0.2 * scale, height * 0.5, 0);
            fun.Axis(dxf, v42, 90, 180, "Y", "Z", "MCS", 0.2 * scale, height * 0.5, 0);
            fun.Axis(dxf, v11, 90, 180, "Y", "Z", "", 0.2 * scale, height * 0.5, 0)*/
            
            //LPR
            fun.dimrot1(dxf, v42, v1, 0, H * 2, 0.1, height, arrowsize, exline, "OAL", "", "");

            //LTA
            fun.dimrot1(dxf, v42, v9, 0, H, 0.1, height, arrowsize, exline, "LTA", "", "");

            //HF
            fun.dimrot1(dxf, v1, v4, -90, LPR * (5.27 / 30.25), 0.1, height, arrowsize, exline, "HF", "", "");

            //H
            fun.dimrot1(dxf, v2, v3, 90, LPR * (8.24 / 30.25), 0.1, height, arrowsize, exline, "H", "", "");

            //HTA
            /*Line line7 = new Line(v1, v45);
            line7.Layer = dimensioning;
            dxf.AddEntity(line7);

            fun.jt1(dxf, v46, 90, 5, 0, "HTA", height);
            fun.jt1(dxf, v46, -90, 3, 0, "", height);*/

            //第二部分
            //坐标系
            /*fun.Axis(dxf, v97, 180, 90, "Z", "X", "PCS", 0.2 * scale, height * 0.5, 0);
            fun.Axis(dxf, v98, 180, 90, "Y", "Z", "MCS", 0.2 * scale, height * 0.5, 0);
            fun.Axis(dxf, v95, KAPR, 90 + KAPR, "X", "Y", "CSW", 0.2 * scale, height * 0.5, 0);*/

            //ADJRG
            fun.dimrot1(dxf, v83, v85, 0, (10.64 / 7.78) * B, 0.1, height, arrowsize, exline, "ADJRG", "", "");

            //LH
            fun.dimrot1(dxf, v56, v47, 0, B * 2, 0.1, height, arrowsize, exline, "LH", "", "");

            //B
            fun.dimrot1(dxf, v54, v55, 90, (8.34 / 36.75) * OAL, 0.1, height, arrowsize, exline, "B", "", "");

            //WF
            fun.dimrot1(dxf, v53, v48, -90, (12 / 36.75) * OAL, 0.1, height, arrowsize, exline, "WF", "", "");

            //WTA
            fun.dimrot1(dxf, v47, v48, -90, (6.26 / 36.75) * OAL, 0.1, height, arrowsize, exline, "WTA", "", "");

            //ASP
            fun.dimrot1(dxf, v97, v55, 180, (12.48 / 7.78) * B, 0.1, height, arrowsize, exline, "ASP", "", "");

            //HMD
            fun.dimrot1(dxf, v97, v98, 180, (20.48 / 7.78) * B, 0.1, height, arrowsize, exline, "HMD", "", "");

            //MHD2
            fun.dimrot1(dxf, v98, new Vector2(v84.X + fun.CalDistance(v88, v90) / 2.0, v88.Y), 180, ((20.48 - 2.9) / 7.78) * B, 0.1, height, arrowsize, exline, "MHD2", "", "");

            //LS
            fun.dimrot1(dxf, v97, v60, 180, (24.17 / 7.78) * B, 0.1, height, arrowsize, exline, "LS", "", "");

            //LF
            fun.dimrot1(dxf, v97, v48, 180, (25.57 / 7.78) * B, 0.1, height, arrowsize, exline, "LF", "", "");

            //OAL
            fun.dimrot1(dxf, v97, v47, 180, (31.26 / 7.78) * B, 0.1, height, arrowsize, exline, "OAL", "", "");

            //LFA
            fun.dimrot1(dxf, v48, v47, 180, ((20.9 + 1.34) / 7.78) * B, 0.1, height, arrowsize, exline, "LFA", "", "");

            //角度标注
            //KAPR
            fun.jdbz2(dxf, new Line(v48, fun.Polar(v48, 0 * pi / 180, 0.1)), new Line(v48, fun.Polar(v48, KAPR * pi / 180, 0.1)), WF * 1.5, height, arrowsize, exline, "KAPR", "", "");

            //箭头
            //FDP
            //fun.jt1(dxf, v96, 180, 5, 1, "FDP", height);

            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            Vector2 p0 = new Vector2(0, 0);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }

            //定义格式，根据路径导出
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
    }
}
